#define _CRT_SECURE_NO_WARNINGS 1
class Solution {
public:
    vector<vector<int>> ret;
    vector<int> path;
    bool check[20];
    vector<vector<int>> combine(int n, int k)
    {
        dfs(n, k, 1);
        //check.resize(n+1);
        return ret;
    }

    void dfs(int n, int k, int pos)
    {
        if (path.size() == k)
        {
            ret.push_back(path);
            return;
        }
        for (int i = pos; i <= n; i++)
        {
            if (check[i] == false)
            {
                path.push_back(i);
                check[i] = true;
                dfs(n, k, i + 1);
                path.pop_back();
                check[i] = false;
            }
        }
        return;
    }
};